import java.util.List;

public class Test {
    public static void main(String[] args) {
        BinaryTreeLinkList binaryTreeLinkList=new BinaryTreeLinkList();
        BinaryTreeLinkList.BinaryTreeNode root=binaryTreeLinkList.createinary();
        System.out.println("前序遍历：");
        binaryTreeLinkList.prevOrder(root);
        System.out.println();
        System.out.println("中序遍历：");
        binaryTreeLinkList.inOrder(root);
        System.out.println();
        System.out.println("后序遍历：");
        binaryTreeLinkList.postOrder(root);
        System.out.println();
        System.out.println("二叉树中节点的个数+前序遍历：");
        System.out.println(binaryTreeLinkList.Size(root));
        binaryTreeLinkList.prevSize(root);
        System.out.println(binaryTreeLinkList.count);
        binaryTreeLinkList.inSize(root);
        System.out.println(binaryTreeLinkList.count);
        binaryTreeLinkList.postSize(root);
        System.out.println(binaryTreeLinkList.count);
        System.out.println("=============");
        //这里的counts全局变量，就很容易有问题
        System.out.println(binaryTreeLinkList.getLeafNodeCount(root));
        System.out.println("=========");
        binaryTreeLinkList.prevGetLeafNodeCount(root);
        System.out.println(binaryTreeLinkList.LeafNodeCount);
        binaryTreeLinkList.inGetLeafNodeCount(root);
        System.out.println(binaryTreeLinkList.LeafNodeCount);
        binaryTreeLinkList.postGetLeafNodeCount(root);
        System.out.println(binaryTreeLinkList.LeafNodeCount);
        System.out.println("=======");
        System.out.println(binaryTreeLinkList.getKLevelNodeCount(root, 3));
        System.out.println("=====================");
        System.out.println(binaryTreeLinkList.getHeight(root));
        System.out.println(binaryTreeLinkList.getHight2(root));
        System.out.println("==============");
        List<List<BinaryTreeLinkList.BinaryTreeNode>> ret=binaryTreeLinkList.levelOrder2(root);
        for (int i = 0; i < ret.size(); i++) {
            for(int j=0;j<ret.get(i).size();j++) {
                System.out.print(ret.get(i).get(j).val);
            }
            System.out.println();
        }
        System.out.println("++++++++++++++++++++");
        System.out.println(ret.get(0).get(0).val);
        System.out.println(ret.get(1).get(0).val);
        System.out.println(ret.get(1).get(1).val);
        System.out.println(ret.get(2).get(0).val);
        System.out.println(ret.get(2).get(1).val);
        System.out.println(ret.get(2).get(2).val);
        System.out.println(ret.get(2).get(3).val);
        System.out.println(ret.get(3).get(0).val);


    }
}
